//
//  WSBaseRefreshTableView.m
//  MurderMystery
//
//  Created by zhangcong on 2018/9/10.
//  Copyright © 2018年 luomz. All rights reserved.
//

#import "WSBaseRefreshTableView.h"

#import <MJRefresh.h>
@implementation WSBaseRefreshTableView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self setupRefresh];
    }
    return self;
}

#pragma mark private methods
//刷新
- (void)setupRefresh {
    MJRefreshNormalHeader *refreshHead = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(didRequest)];
    refreshHead.arrowView.hidden = YES;
//    [ShareClass setMjHeaderWhiteMode:refreshHead];
    self.tableView.mj_header = refreshHead;
    if (![self forbidAutoRefresh])
    [self.tableView.mj_header beginRefreshing];
}

- (void)didRequest {
    //子类实现
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [self.tableView.mj_header endRefreshing];
    });
}

@end
